<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<div class="col-mb-12 col-3 kit-hidden-tb" id="secondary" role="complementary">
    <?php if (!empty($this->options->sidebarBlock) && in_array('ShowRecentPosts', $this->options->sidebarBlock)): ?>
    <section class="widget">
        <h3 class="widget-title">
            <i class="fas fa-clock"></i> <?php _e('最新文章'); ?>
        </h3>
        <ul class="widget-list recent-posts">
            <?php $this->widget('Widget_Contents_Post_Recent')
            ->parse('<li>
                <a href="{permalink}">
                    <span class="post-title">{title}</span>
                    <span class="post-date">{year}-{month}-{day}</span>
                </a>
            </li>'); ?>
        </ul>
    </section>
    <?php endif; ?>

    <?php if (!empty($this->options->sidebarBlock) && in_array('ShowRecentComments', $this->options->sidebarBlock)): ?>
    <section class="widget">
        <h3 class="widget-title">
            <i class="fas fa-comments"></i> <?php _e('最近回复'); ?>
        </h3>
        <ul class="widget-list recent-comments">
        <?php $this->widget('Widget_Comments_Recent')->to($comments); ?>
        <?php while($comments->next()): ?>
            <li>
                <div class="comment-avatar">
                    <?php $comments->gravatar('40', 'mp', true, 'avatar'); ?>
                </div>
                <div class="comment-content">
                    <div class="comment-author"><?php $comments->author(false); ?></div>
                    <div class="comment-text"><?php $comments->excerpt(35, '...'); ?></div>
                </div>
            </li>
        <?php endwhile; ?>
        </ul>
    </section>
    <?php endif; ?>

    <?php if (!empty($this->options->sidebarBlock) && in_array('ShowCategory', $this->options->sidebarBlock)): ?>
    <section class="widget">
        <h3 class="widget-title">
            <i class="fas fa-folder"></i> <?php _e('分类'); ?>
        </h3>
        <ul class="widget-list categories">
            <?php $this->widget('Widget_Metas_Category_List')
            ->parse('<li><a href="{permalink}">
                <span class="name">{name}</span>
                <span class="count">({count})</span>
            </a></li>'); ?>
        </ul>
    </section>
    <?php endif; ?>

    <?php if (!empty($this->options->sidebarBlock) && in_array('ShowArchive', $this->options->sidebarBlock)): ?>
    <section class="widget">
        <h3 class="widget-title">
            <i class="fas fa-archive"></i> <?php _e('归档'); ?>
        </h3>
        <ul class="widget-list archives">
            <?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y年m月')
            ->parse('<li><a href="{permalink}">
                <span class="name">{date}</span>
                <span class="count">({count})</span>
            </a></li>'); ?>
        </ul>
    </section>
    <?php endif; ?>

    <?php if (!empty($this->options->sidebarBlock) && in_array('ShowOther', $this->options->sidebarBlock)): ?>
    <section class="widget">
        <h3 class="widget-title">
            <i class="fas fa-cog"></i> <?php _e('其它'); ?>
        </h3>
        <ul class="widget-list">
            <?php if($this->user->hasLogin()): ?>
                <li class="last"><a href="<?php $this->options->adminUrl(); ?>">
                    <i class="fas fa-tachometer-alt"></i> <?php _e('进入后台'); ?> (<?php $this->user->screenName(); ?>)
                </a></li>
                <li><a href="<?php $this->options->logoutUrl(); ?>">
                    <i class="fas fa-sign-out-alt"></i> <?php _e('退出'); ?>
                </a></li>
            <?php else: ?>
                <li class="last"><a href="<?php $this->options->adminUrl('login.php'); ?>">
                    <i class="fas fa-sign-in-alt"></i> <?php _e('登录'); ?>
                </a></li>
            <?php endif; ?>
            <li><a href="<?php $this->options->feedUrl(); ?>">
                <i class="fas fa-rss"></i> <?php _e('文章 RSS'); ?>
            </a></li>
            <li><a href="<?php $this->options->commentsFeedUrl(); ?>">
                <i class="fas fa-rss-square"></i> <?php _e('评论 RSS'); ?>
            </a></li>
        </ul>
    </section>
    <?php endif; ?>
</div>
